/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.deployment.entities;

import br.com.deployment.enums.TypeIssues;
import java.io.Serializable;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.SequenceGenerator;

/**
 *
 * @author roniere
 */
/**
 * Pergunta/Questão
 *
 * @author roniere
 */
@Entity
public class Issues implements Serializable {

    @Id
    @SequenceGenerator(name = "seq_issues", sequenceName = "seq_issues", allocationSize = 1)
    @GeneratedValue(generator = "seq_issues", strategy = GenerationType.SEQUENCE)
    private Long id;
    @Column
    private Long cod;
    @OneToMany(cascade = CascadeType.ALL)
    private List<Options> options;
    @Enumerated(EnumType.ORDINAL)
    private TypeIssues typeIssues;
    @Column
    private String responseOpen;
    
    @OneToOne(cascade = CascadeType.ALL)
    private Category category;
    
    @OneToOne
    private Questionnaire questionnaire;
    
    @Column
    private String title;

    @Column
    private boolean active;
    
    @Column(length=25500)
    private String orientacion;
    
    public Issues() {
         this.active = true;
    }

    public Category getCategory() {
        return category;
    }

    public void setCategory(Category category_id) {
        this.category = category_id;
    }
    
    public Long getCod() {
        return cod;
    }

    public void setCod(Long cod) {
        this.cod = cod;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public List<Options> getOptions() {
        return options;
    }

    public void setOptions(List<Options> options) {
        this.options = options;
    }

   

    public String getResponseOpen() {
        return responseOpen;
    }

    public void setResponseOpen(String responseOpen) {
        this.responseOpen = responseOpen;
    }

    public TypeIssues getTypeIssues() {
        return typeIssues;
    }

    public void setTypeIssues(TypeIssues typeIssues) {
        this.typeIssues = typeIssues;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public Questionnaire getQuestionnaire() {
        return questionnaire;
    }

    public void setQuestionnaire(Questionnaire questionnaire) {
        this.questionnaire = questionnaire;
    }

    public boolean isActive() {
        return active;
    }

    public void setActive(boolean active) {
        this.active = active;
    }

    public String getOrientacion() {
        return orientacion;
    }

    public void setOrientacion(String orientacion) {
        this.orientacion = orientacion;
    }
    
   
    @Override
    public int hashCode() {
        int hash = 7;
        hash = 71 * hash + (this.id != null ? this.id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Issues other = (Issues) obj;
        if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Issues{" + "id=" + id + ", cod=" + cod + ", options=" + options +" title=" + title + '}';
    }

}
